package org.thinkinbunny.financial.billentity;

import java.io.Serializable;

import org.thinkinbunny.financial.activity.MyActivity;
import org.thinkinbunny.financial.util.Constant;
import org.thinkinbunny.financial.util.Log;

import android.content.Context;
import android.content.SharedPreferences;

public class UserEntiry implements Serializable {
	private String username;
	private boolean remember;

	public UserEntiry getUserEntiry(MyActivity myActivity) {
		UserEntiry userEntiry = new UserEntiry();
		SharedPreferences pref = myActivity.getSharedPreferences(
				Constant.FILE_SHARE, Context.MODE_PRIVATE);

		Log.i("UserEntity", userEntiry.toString());
		if (pref.getBoolean("saved", false)) {
			userEntiry.setPassword(pref.getString("password", null));
			userEntiry.setUsername(pref.getString("username", null));
			userEntiry.setRemember(pref.getBoolean("saved", false));
			return userEntiry;
		}
		return null;

		// TODO Auto-generated constructor stub
	}

	@Override
	public String toString() {
		return "UserEntiry [username=" + username + ", remember=" + remember
				+ ", email=" + email + ", password=" + password + "]";
	}

	public boolean isRemember() {
		return remember;
	}

	public void setRemember(boolean remember) {
		this.remember = remember;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	private String email;

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	private String password;

}
